<?php
set_time_limit(0);





session_start();
@$idUsuario = $_SESSION['idUsuario'];

if  ($idUsuario <= 0) {
	echo "Sem acesso.";
    exit();
}



$aquivoNome = $_GET['idUser'].'.jpg';
$arquivoLocal = '../Content/user/'.$aquivoNome; 

if (!file_exists($arquivoLocal)) {
	exit;
}

$novoNome = 'teste.jpg';

header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename="'.$novoNome.'"');
header('Content-Type: application/octet-stream');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($arquivoLocal));
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Expires: 0');

readfile($arquivoLocal);

echo "<script>window.open('../View/principal.php?id=1', '_self');</script>";
?>